<!--
* description: 车型小类查询
* author: liks
* createdDate: 2020-04-22
-->
<template>
  <section class="carTypeConfig">
    <el-dialog v-dialogDrag
      title="车型选择"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="closeCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader
        slot="title"
        :title="'车型选择'"
        :styleType="$store.state.app.dialogType"
      ></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
        :dynamicIsInitTable="true"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { orgApis } from "@/api/apiList/org";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";

export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: orgApis.mdmSmallCarTypeQueryListForPage,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        }, //查询
        {
          compKey: "btnKey3",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode(this.codeField, "smallCarTypeCn"),
          text: "确认",
          position: "bottom"
        }, //确认
        {
          compKey: "btnKey2",
          type: "",
          size: "small",
          clickEvent: () => this.reset1(),
          text: "重置",
          position: "top"
        } //重置
      ],
      // 动态组件-查询条件
      tableComponents: [],
      // 静态组件-查询条件
      staticTableComponents: [
        // 显示组件
        {
          compKey: "compKey1",
          labelName: "品牌",
          codeField: "carBrandCode",
          component: () => import("@/components/org/carBrand/carBrand"),
          type: "dropdownList",
          isMust: true
        }, //品牌
        {
          compKey: "compKey2",
          labelName: "车系",
          codeField: "carSeriesId",
          parentFileds: "carBrandCode",
          component: () => import("@/components/org/CarCode"),
          type: "dropdownList",
          filterable:true,
          // disabled:this.formField.carSeriesId===""?false:true,
          isMust: true
        }, //车系
        {
          compKey: "compKey3",
          labelName: "车型",
          codeField: "smallCarTypeId",
          parentFileds: "carBrandCode|carSeriesId",
          component: () => import("@/components/org/SmallCarType"),
          filterable:true,
          type: "dropdownList",
          isMust: true
        }, //车型(车型小类)
        // 隐藏组件

      ],
      // 动态生成网格列
      tableCols: [],
      // 静态生成网格列
      staticTableCols: [
        {
          prop: "carBrandCn",
          label: "品牌",
          width: null,
          align: "center"
        }, //品牌
        {
          prop: "carBrandCode",
          label: "品牌",
          width: null,
          align: "center",
          hidden:true
        },
        {
          prop: "carSeriesCn",
          label: "车系",
          width: null,
          align: "center"
        }, //'车系'
        {
          prop: "carSeriesCode",
          label: "车系编码",
          width: null,
          align: "center",
          hidden: true
        },
        {
          prop: "carSeriesId",
          label: "车系Id",
          width: 150,
          align: "center",
          hidden: true
        },
        {
          prop: "smallCarTypeCn",
          label: "车型名称",
          width: null,
          align: "center"
        }, //车型名称
        {
          prop: "smallCarTypeCode",
          label: "车型编码",
          width: null,
          align: "center"
        }, //车型

        {
          prop: "smallCarTypeId",
          label: "车型Id",
          width: 0,
          align: "center",
          hidden: true
        },
      ],
      //表单查询数据（查询条件）
      formField: {
        carBrandCode: "",
        carSeriesId: "",
        smallCarTypeId: "",
        isEnable:'1'
      },
      handleTableRowData: {
        value: this.codeField,
        text: "smallCarTypeCn"
      }
    };
  },
  methods:{
    reset1(){
      this.reset()
      this.formField.carSeriesId=''
    }
  }
};
</script>
